package com.bw.liuyushan.liuyushan20210904.Adapter;

import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentStatePagerAdapter;

import java.util.ArrayList;

/**
 * Liuyushan20210904
 * file name is : TableFragmentAdapter
 * created by Ender on 2021/9/4 9:14.
 * author : 刘雨杉
 * Describe:
 */
public class TableFragmentAdapter extends FragmentStatePagerAdapter {
    ArrayList<Fragment> fragments;
    ArrayList<String> strings;

    public TableFragmentAdapter(FragmentManager fm, ArrayList<Fragment> fragments, ArrayList<String> strings) {
        super(fm);
        this.fragments = fragments;
        this.strings = strings;
    }

    @Override
    public Fragment getItem(int position) {
        return fragments.get(position);
    }

    @Override
    public int getCount() {
        return fragments.size();
    }

    @Nullable
    @Override
    public CharSequence getPageTitle(int position) {
        return strings.get(position);
    }
}
